<template>
	<view class="content">
		<yd-classification :list="type" :index="index" :selectedColor="color" :type1LineHeight="lineheight1" :type1Size="size1" :type2Size="size2" :type3Size="size3" :type1Height="heigth1" @selectType="select"></yd-classification>
	</view>
</template>

<script>
	import {
		getCate
	} from '@/api/home.js'
	export default {
		data() {
			return {
				type:[],
				// type: [ { name: "显示的type1", child: [ { name: "显示的type2", child: [ { name: "显示的type3", icon: "对应type3上方显示的图片链接" } ] } ] } ],
				index: 3,
				color: "#151515",
				size1: "16px",
				size2: "14px",
				size3: "10px",
				heigth1: "160rpx",
				lineheight1: "160rpx"
				// type11: []
			}
		},
		watch: {
			type: function(val){
				console.log("现在type的值",val)
			}
		},
		onLoad(options) {
			console.log(options.index,'options')
			this.index = Number(options.index);
			// this.getTypes()
			this.Cate()
		},
		methods: {
			// async getTypes() {
			// 	const res = await uni.request({
			// 			url: "http://localhost:9003/GetTypes"
			// 	})
			// 	this.type = res[1].data.data
			// },
			Cate(){
				getCate({}).then(res => {
					this.type = res.data
					
				}).catch(err => {
					console.log(2222, err)
				})
			},
			select(id){
				console.log("点击传来的值为",id)
				uni.navigateTo({
					url: '/pages/detail/index?type=2' + '&id=' + id
				})
			}
		}
	}
</script>

<style>
	
</style>
